@page "/"
@namespace Oqtane.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@model Oqtane.Pages.HostModel
<!DOCTYPE html>
<html lang="@Model.Language">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <base href="~/" />
    <script src="js/app.js"></script>
    <script src="js/loadjs.min.js"></script>
    <link rel="stylesheet" href="css/app.css" />
    @if (!string.IsNullOrEmpty(Model.PWAScript))
    {
        <link id="app-manifest" rel="manifest" />
    }
    @Html.Raw(Model.StyleSheets)
    <link id="app-stylesheet-page" />
    <link id="app-stylesheet-module" />
    <component type="typeof(Oqtane.Head)" render-mode="@((RenderMode)Enum.Parse(typeof(RenderMode), Model.RenderMode, true))" />
    @Html.Raw(Model.HeadResources)
</head>
<body>
	@if (string.IsNullOrEmpty(Model.Message))
	{
		@(Html.AntiForgeryToken())

		<component type="typeof(Oqtane.App)" render-mode="@((RenderMode)Enum.Parse(typeof(RenderMode), Model.RenderMode, true))" param-AntiForgeryToken="@Model.AntiForgeryToken" param-Runtime="@Model.Runtime" param-RenderMode="@Model.RenderMode.ToString()" param-VisitorId="@Model.VisitorId" param-RemoteIPAddress="@Model.RemoteIPAddress" param-AuthorizationToken="@Model.AuthorizationToken" />

		<div id="blazor-error-ui">
			<environment include="Staging,Production">
				An error has occurred. This application may no longer respond until reloaded.
			</environment>
			<environment include="Development">
				An unhandled exception has occurred. See browser dev tools for details.
			</environment>
			<a href="" class="reload">Reload</a>
			<a class="dismiss">🗙</a>
		</div>

		<script src="js/interop.js"></script>

		@if (Model.Runtime == "WebAssembly")
		{
			<script src="_framework/blazor.webassembly.js"></script>
		}
		@if (Model.Runtime == "Server")
		{
			<script src="_framework/blazor.server.js"></script>
		}
		@if (!string.IsNullOrEmpty(Model.ReconnectScript))
		{
			@Html.Raw(Model.ReconnectScript)
		}
        @if (!string.IsNullOrEmpty(Model.PWAScript))
        {
            @Html.Raw(Model.PWAScript)
        }
        @Html.Raw(Model.BodyResources)
    }
	else
	{
		<div class="app-alert">@Model.Message</div>
	}
</body>
</html>
